home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 August / MW 8 2003 CD1.iso / Inside Macworld / Product News / gimp-1.2.4.sit / gimp-1.2.4 / plug-ins / perl / examples / roundsel < prev    next >
Encoding:
Text File  |  2000-03-28  |  1.0 KB  |  43 lines

  1. #!/usr/app/bin/perl
  2.  
  3. eval 'exec /usr/app/bin/perl  -S $0 ${1+"$@"}'
  4.     if 0; # not running under some shell
  5. # Use gaussian blur and levels to round selection corners
  6.  
  7. use Gimp qw(:auto __ N_);
  8. use Gimp::Fu;
  9. use Gimp::Util;
  10.  
  11. # Gimp::set_trace(TRACE_ALL);
  12.  
  13. register "round_sel", 
  14.          "Rounds a selection.",
  15.          "Rounds a selection.",
  16.          "Uri Zarfaty", 
  17.          "Uri Zarfaty <udz20\@cam.ac.uk>", 
  18.          "1999-03-25",
  19.          N_"<Image>/Select/Round...", 
  20.          "*", 
  21.          [ 
  22.            [PF_SPINNER, "roundness", "How much to round, in pixels", 16, [1,1000,1]], 
  23.          ], sub {
  24.     my($img,$drawable,$round) = @_;
  25.  
  26.     eval { $img->undo_push_group_start };
  27.     
  28.     my $channel = gimp_selection_save($img);
  29.     gimp_selection_none($img);
  30.     plug_in_gauss_iir($img, $channel, $round, 1, 1);
  31.     gimp_levels($channel, 0, 123, 133, 1.0, 0, 255);
  32.     gimp_selection_load($channel);
  33.     gimp_image_remove_channel($img, $channel);
  34.     # gimp_channel_delete($channel);
  35.     
  36.     eval { $img->undo_push_group_end };
  37.  
  38.     ();
  39. };
  40.  
  41. exit main;
  42.  
  43.